﻿
Imports System
Imports System.Drawing
Imports System.Globalization
Imports System.Windows.Forms

Public Class HourTextBox
    Inherits TextBox

    Protected Overrides Sub OnKeyPress(ByVal e As KeyPressEventArgs)

        MyBase.OnKeyPress(e)

        ' set maxlength of textbox
        MyBase.MaxLength = 4

        ' check only allow numeric
        If (Char.IsDigit(e.KeyChar) Or Char.IsControl(e.KeyChar)) Then

            e.Handled = False

        Else
            ' cancel
            e.Handled = True

        End If

    End Sub

    Protected Overrides Sub OnEnter(ByVal e As EventArgs)

        MyBase.OnEnter(e)



    End Sub

End Class
